<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:util="http://www.springframework.org/schema/util" 
xmlns:mvc="http://www.springframework.org/schema/mvc" 
xmlns:p="http://www.springframework.org/schema/p" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 

xsi:schemaLocation="http://www.springframework.org/schema/beans 
					http://www.springframework.org/schema/beans/spring-beans-3.1.xsd                 
					http://www.springframework.org/schema/util
					http://www.springframework.org/schema/util/spring-util-3.1.xsd                 
					http://www.springframework.org/schema/context 
					http://www.springframework.org/schema/context/spring-context-3.1.xsd                 
					http://www.springframework.org/schema/mvc 
					http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">

	
					
	<context:property-placeholder location="file:/JDESURVEY/config/configuration.properties"/>

					
					
    <!-- The controllers are autodetected POJOs labeled with the @Controller annotation. -->
    <context:component-scan base-package="com.jd.survey.web" use-default-filters="false">
        <context:include-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
    </context:component-scan>
    
    <!-- Turns on support for mapping requests to Spring MVC @Controller methods
         Also registers default Formatters and Validators for use across all @Controllers -->
     <mvc:annotation-driven conversion-service="applicationConversionService"/>
    

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources -->
    <mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>

    <!-- Allows for mapping the DispatcherServlet to "/" by forwarding static resource 
    requests to the container's default Servlet -->
    <mvc:default-servlet-handler/>

    <!-- Register "global" interceptor beans to apply to all registered HandlerMappings -->
    <mvc:interceptors>
        <bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor"/>
        <!-- <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" p:paramName="lang"/> -->
    </mvc:interceptors>

    <!-- Selects a static view for rendering without the need for an explicit controller -->
    <mvc:view-controller path="/public/login"/>
	<mvc:view-controller path="/uncaughtException"/>
    <mvc:view-controller path="/resourceNotFound"/>
    <mvc:view-controller path="/dataAccessFailure"/>
	<mvc:view-controller path="/accessDenied" />
	
	
    <!-- Resolves localized messages*.properties and application.properties files in the application to allow for internationalization. 
    The messages*.properties files translate Roo generated messages which are part of the admin interface, the 
    application.properties resource bundle localizes all application specific messages such as entity names and menu items. -->
    <bean class="org.springframework.context.support.ReloadableResourceBundleMessageSource" id="messageSource" p:basenames="WEB-INF/i18n/messages,WEB-INF/i18n/application" p:fallbackToSystemLocale="false" p:cacheSeconds="1"/>
	
	
	

    <!-- Store preferred language configuration in a cookie -->

     <!-- <bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="JDlocale" p:defaultLocale="ar"  /> -->
    <!--  <bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="JDlocale" p:defaultLocale="en_US"  /> -->
	<!-- <bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="JDlocale" p:defaultLocale=" fr_FR" /> -->  

    <!-- <bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="JDlocale" p:defaultLocale="ar"  /> -->
    <bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="JDlocale" p:defaultLocale="en_US"  />
    <!--<bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="JDlocale" p:defaultLocale="es_ES"  />-->
    <!--<bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="JDlocale" p:defaultLocale="pt_PT"  />-->
    <!-- <bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="JDlocale" p:defaultLocale=" fr_FR" /> -->  

	
    <!-- Resolves localized <theme_name>.properties files in the classpath to allow for theme support -->
    <bean class="org.springframework.ui.context.support.ResourceBundleThemeSource" id="themeSource"/>

    <!-- Store preferred theme configuration in a cookie -->
	<!-- <bean class="org.springframework.web.servlet.theme.CookieThemeResolver" id="themeResolver" p:cookieName="theme" p:defaultThemeName="alt"/>-->
    <bean class="org.springframework.web.servlet.theme.CookieThemeResolver" id="themeResolver" p:cookieName="theme" p:defaultThemeName="standard"/> 
    
	

    <!-- This bean resolves specific types of exceptions to corresponding logical - view names for error views. 
    The default behaviour of DispatcherServlet - is to propagate all exceptions to the servlet 
    container: this will happen - here with all other types of exceptions. -->
    <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver" p:defaultErrorView="uncaughtException">
        <property name="exceptionMappings">
            <props>
                <prop key=".DataAccessException">dataAccessFailure</prop>
                <prop key=".NoSuchRequestHandlingMethodException">resourceNotFound</prop>
                <prop key=".TypeMismatchException">resourceNotFound</prop>
                <prop key=".MissingServletRequestParameterException">resourceNotFound</prop>
  			    <prop key=".AccessDeniedException">accessDenied</prop>
            </props>
        </property>
    </bean>

    <!-- Enable this for integration of file upload functionality -->
    <bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver" id="multipartResolver"/>
	
	<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver" id="tilesViewResolver">
		<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
	</bean>
	
	<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" id="tilesConfigurer">
		<property name="definitions">
			<list>
			<value>/WEB-INF/layouts/layouts.xml</value>
			<!-- Scan views directory for Tiles configurations -->
			<value>/WEB-INF/views/**/views.xml</value>
			</list>
		</property>
	</bean>
  <bean class="com.jd.survey.web.ApplicationConversionServiceFactoryBean" id="applicationConversionService"/>
			   
  <!-- for easy access to i18n messages from Spring El -->
  <bean id="messages" class="com.jd.survey.web.MessageSourceMapAdapterFactory"/>
  
	
 	<bean class="org.springframework.web.servlet.view.XmlViewResolver">
		<property name="location">
			<value>/WEB-INF/excel-views.xml</value>
		</property>
	</bean>
  
   
  
</beans>
